{%extends "base.html"%}

{%block title%}
<title>Vista de Clasificado {{auto.id}}</title>
{%endblock%}


{%block maincontent%}
<div id="content">
    <h3 class="titulo">{{auto.titulo}}</h3>

<div class="photo_slot">
    <form method="POST" enctype="multipart/form-data" action="{%url caja.views.agregar_fotos_auto auto.id%}" accept="image/gif,image/jpeg,image/png,image/tiff">
        {%csrf_token%}
        <table>
            {{form}}
        </table>
        <input class="button blueb" type="submit" value="Agregar Fotos">
    </form>

</div>

<div class="photo_slot">
    {%for foto in auto.fotoauto_set.all%}
        {%if foto.principal%}
            <div class="imagerv fotoprin">
        {%else%}
            <div class="imagerv">
        {%endif%}

            <a href="/media/{{foto.foto.url}}"><img class="rvgallery" src="/media/{{foto.get_thumb_url}}" /></a>
            <br>
            <form method="POST" action="{%url caja.views.foto_prin_auto foto.id%}">
            {%csrf_token%}
            {%if foto.principal%}
                <input type="submit" value="Portada" class="button" disabled>
            {%else%}
                <input type="submit" value="Portada" class="button blueb">
            {%endif%}
            </form>
            <br>
            <form method="POST" action="{%url caja.views.eliminar_foto_auto foto.id%}">
            {%csrf_token%}
            <input type="submit" value="Eliminar" class="redbutton">
            </form>

        </div>
    {%endfor%}
</div>


    {{auto.pauqete.nombre}}
    <div class="topinfo">
        <table class="info_auto">
        {%if auto.precio%}
        <tr>
            <td>
               <span class="precio"> ${{auto.precio|floatformat:2}} {{auto.get_moneda_display}}</span>
            </td>
        </tr>
        {%endif%}

        <tr>
            <td>{{auto.marca}}, {{auto.modelo}}, {{auto.serie}}</td>
        </tr>
        <tr>
            <td>En {{auto.municipio}}, {{auto.estado}}</td>
        </tr>
        </table>
    </div>


    <p class="descripcion">
        {{auto.descripcion}}
    </p>


    <table class="dets_auto">
        <tr>
            <th>Condicion</th><th>Pasajeros</th>
        </tr>
        <tr>
            <td>{{auto.condicion}}</td>   <td>{{auto.pasajeros}}</td>
        </tr>
        <tr>
            <th>Color</th><th>Transmision</th>
        </tr>
        <tr>
            <td>{{auto.color}}</td><td>{{auto.transmision}}</td>
        </tr>
        <tr>
            <th>Puertas</th><th>Cilindros</th>
        </tr>
        <tr>
            <td>{{auto.puertas}}</td><td>{{auto.cilindros}}</td>
        </tr>
        <tr>
            <th>Combustible</th><th>Kilometraje</th>
        </tr>
        <tr>
            <td>{{auto.combustible}}</td><td>{{auto.kilometraje}}</td>
        </tr>

    </table>



<table class="contact_info">
    <tr>
        <th class="section_title" colspan="2">Informacion de Contacto</th>
    </tr>

    <tr>
        <th>Correo Electronico</th> <td>{{auto.email}}</td>
    </tr>

    <tr>
        <th>Telefono Fijo</th><td>{{auto.telefono}}</td>
    </tr>

    <tr>
        <th>Celular</th><td>{{auto.celular}}</td>
    </tr>

    <tr>
        <th>Direccion</th><td>{{auto.direccion}}</td>
    </tr>
</table>

<div id="controls">
    <a href="{%url caja.views.editar_auto auto.id%}" class="button orangeb fleft"> Regresar y editar </a>
    <form action="{%url caja.views.venta_auto auto.id%}" method="POST">
    {%csrf_token%}
    <input type="submit" class="button blueb fright" value="Confirmar">
    </form>
</div>



</div>
{%endblock%}
